package com.example.test;

import java.util.Scanner;

/**
 * @ClassName testProgram
 * @Description
 * @Author JY
 * @Date 2020/7/25 22:10
 **/
public class testProgram {
    public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        if(count>100||count<=0){
            System.out.print("长度不符合！");
        }else{
            for(int i=0;i<count;i++){
                String str = sc.nextLine();
                if (str.length()>100||str.length()<=0){
                    System.out.print("条件不符合！");
                }else {
                    System.out.print(check(str) ? "YES":"NO");
                }
            }
        }
    }
    public static Boolean check(String str){
        String pattern = "[A-Za-z]([A-Za-z]+[0-9]*|[A-Z0-9]+[a-z]*|[a-z0-9]+[A-Z]*){7,}";
        return str.matches(pattern);
    }
}
